#ifndef __SHADER_H__
#define __SHADER_H__

#include "Mesh.h"
#include "Entity.h"
#include <utility>
#include <map>
#include <string>
#include <boost/smart_ptr/shared_ptr.hpp>


class CShader : public IEntity
{
public:
	enum eParmTypes
	{
		Float,
		Vector3,
		Vector4,
		Matrix
	};

	CShader()
	{
		++m_id;
	}

	virtual ~CShader()
	{}

	virtual void render(MeshPtr mesh)
	{}

	void addParameter(CShader::eParmTypes typ, const char* parmName);
	void setParameter(const char* parmName, const void* pValue);

	inline unsigned int getID() const
	{
		return m_id;
	}

protected:
	typedef std::map<std::string, std::pair<CShader::eParmTypes, const void *>> typMapParm;
	typMapParm			m_mapParms;


private:
	static unsigned int m_id;
};
typedef boost::shared_ptr<CShader> ShaderPtr;


// Binary predicate
struct ShaderIdentity : public std::binary_function<ShaderPtr, unsigned int, bool>
{
	bool operator() (const ShaderPtr pShader, const unsigned int& uiID) const
	{
		return (pShader->getID() == uiID);
	}
};

#endif // __SHADER_H__